package com.ansuenjob.jsonBuilder;

import java.util.List;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import com.ansuenjob.model.Company;
import com.ansuenjob.model.Job;
import com.ansuenjob.vo.CompanyVo;
import com.ansuenjob.vo.JobVO;

public class CompanyVoBuilder extends JSONBuilde<CompanyVo>{

	@Override
	public CompanyVo buildJson(JSONObject jsonObject) throws JSONException {
		CompanyBuilder comBuilder = new CompanyBuilder();			
		JSONObject jCompany = jsonObject.getJSONObject("company");
		JSONArray jJobs	= jsonObject.getJSONArray("jobs");
		Company company = comBuilder.buildJson(jCompany);
		List<Job> jobs = JobFunctions.getJobs(jJobs);
		CompanyVo companyVo = new CompanyVo(company, jobs);
		return companyVo;
	}

}
